namespace Core.Base
{

    /// <summary>
    /// 定义单例通用接口
    /// </summary>
    public interface ISingleton
    {

        /// <summary>
        ///  初始化
        /// </summary>
        public abstract void OnInit();
        /// <summary>
        ///  释放
        /// </summary>
        public abstract void OnDestory();
    }

    /// <summary>
    /// 单例基类
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class Singleton<T> where T : class, new()
    {
        private static T _instance = new T();
        public static T Instance => _instance;

        public static void Destory()
        {
            _instance = null;
        }

    }
}